package com.gxa.p2p.pojo;

import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

// 账户信息
@ToString
public class AccountInfo implements Serializable {

  private static final long serialVersionUID = 1370170982257476814L;

  // 存储用户的具体登录登出信息
  private List<LoginLog> loginLogList;

  public List<LoginLog> getLoginLogList() {
    return loginLogList;
  }

  public void setLoginLogList(List<LoginLog> loginLogList) {
    this.loginLogList = loginLogList;
  }

  private Integer id;
  /** 用户ID */
  private Integer userId;
  private String userName;
  /** 交易密码 */
  private String tradePassword;
  /** 可用金额 */
  private BigDecimal usableAmount;
  /** 冻结金额 */
  private BigDecimal frozenAmount;
  /** 待收利息 */
  private BigDecimal unreceiveInterest;
  /** 待收本金 */
  private BigDecimal unreceivePrincipal;
  /** 待还金额 */
  private BigDecimal unreturnAmount;
  /** 可用额度 */
  private BigDecimal remainCredits;
  /** 总额度 */
  private BigDecimal totalCredits;
  /** 创建日期 */
  private Date createdDate;
  /** 上次登录时间 */
  private Date lastLoginDate;

  public AccountInfo(
      Integer id,
      Integer userId,
      String tradePassword,
      BigDecimal usableAmount,
      BigDecimal frozenAmount,
      BigDecimal unreceiveInterest,
      BigDecimal unreceivePrincipal,
      BigDecimal unreturnAmount,
      BigDecimal remainCredits,
      BigDecimal totalCredits,
      Date createdDate,
      Date lastLoginDate) {
    this.id = id;
    this.userId = userId;
    this.tradePassword = tradePassword;
    this.usableAmount = usableAmount;
    this.frozenAmount = frozenAmount;
    this.unreceiveInterest = unreceiveInterest;
    this.unreceivePrincipal = unreceivePrincipal;
    this.unreturnAmount = unreturnAmount;
    this.remainCredits = remainCredits;
    this.totalCredits = totalCredits;
    this.createdDate = createdDate;
    this.lastLoginDate = lastLoginDate;
  }

  public AccountInfo() {
    super();
  }

  public void setUserName(String userName) {
    this.userName = userName;
  }

  public String getUserName() {
    return userName;
  }

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public Integer getUserId() {
    return userId;
  }

  public void setUserId(Integer userId) {
    this.userId = userId;
  }

  public String getTradePassword() {
    return tradePassword;
  }

  public void setTradePassword(String tradePassword) {
    this.tradePassword = tradePassword == null ? null : tradePassword.trim();
  }

  public BigDecimal getUsableAmount() {
    return usableAmount;
  }

  public void setUsableAmount(BigDecimal usableAmount) {
    this.usableAmount = usableAmount;
  }

  public BigDecimal getFrozenAmount() {
    return frozenAmount;
  }

  public void setFrozenAmount(BigDecimal frozenAmount) {
    this.frozenAmount = frozenAmount;
  }

  public BigDecimal getUnreceiveInterest() {
    return unreceiveInterest;
  }

  public void setUnreceiveInterest(BigDecimal unreceiveInterest) {
    this.unreceiveInterest = unreceiveInterest;
  }

  public BigDecimal getUnreceivePrincipal() {
    return unreceivePrincipal;
  }

  public void setUnreceivePrincipal(BigDecimal unreceivePrincipal) {
    this.unreceivePrincipal = unreceivePrincipal;
  }

  public BigDecimal getUnreturnAmount() {
    return unreturnAmount;
  }

  public void setUnreturnAmount(BigDecimal unreturnAmount) {
    this.unreturnAmount = unreturnAmount;
  }

  public BigDecimal getRemainCredits() {
    return remainCredits;
  }

  public void setRemainCredits(BigDecimal remainCredits) {
    this.remainCredits = remainCredits;
  }

  public BigDecimal getTotalCredits() {
    return totalCredits;
  }

  public void setTotalCredits(BigDecimal totalCredits) {
    this.totalCredits = totalCredits;
  }

  public Date getCreatedDate() {
    return createdDate;
  }

  public void setCreatedDate(Date createdDate) {
    this.createdDate = createdDate;
  }

  public Date getLastLoginDate() {
    return lastLoginDate;
  }

  public void setLastLoginDate(Date lastLoginDate) {
    this.lastLoginDate = lastLoginDate;
  }

  public Map<String, Object> getAssetDetails() {
    Map<String, Object> map = new HashMap<>();
    map.put("usableAmount", this.usableAmount);
    map.put("frozenAmount", this.frozenAmount);
    map.put("unreceiveInterest", this.unreceiveInterest);
    map.put("unreceivePrincipal", this.unreceivePrincipal);
    map.put("unreturnAmount", this.unreturnAmount);
    map.put("remainCredits", this.remainCredits);
    map.put("totalCredits", this.totalCredits);
    return map;
  }
}
